<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ page isELIgnored="true" %>
<%@ page import = "java.util.*" %>
<jsp:useBean id="user" scope="session" class="worklog.db.UserDB"/>
<%
	Object isLoggedObj = session.getAttribute("logged");
	Boolean isLogged = false;
	if (isLoggedObj != null) isLogged = (Boolean) isLoggedObj;
	if (!isLogged) response.sendRedirect("login.jsp");
%>

<nav class="mainmenu">
	<%
		String username = (String) session.getAttribute("username");
		if (username != null){
			out.print("<a class=\"mainmenu-item mainmenu-item-right mainmenu-item-logout\" href=\"login\">Logout</a>");
			out.print("<a class=\"mainmenu-item mainmenu-item-right mainmenu-icon icon-password\" title=\"Change password\"></a>");
		}	
		out.print("<a class=\"mainmenu-item mainmenu-item-right mainmenu-icon icon-weekends\" title=\"Toggle weekends\"></a>");
		if (username != null) out.print("<span class=\"mainmenu-item mainmenu-item-right\">Logged as: <b>"+username+"</b></span>");
	%>
	<a class="mainmenu-item mainmenu-item-active" href="index.jsp">Work Log</a>
	<a class="mainmenu-item" href="project-stats.jsp">Project Stats</a>
	<a class="mainmenu-item" href="user-stats.jsp">User Stats</a>
	<a class="mainmenu-item" href="project-log.jsp">Project Log</a>
	<%
		Object statusO = session.getAttribute("status");
		if (statusO != null && (Integer) statusO > 1) out.print("<a class=\"mainmenu-item\" href=\"admin.jsp\">Admin</a>");
	%>
</nav>
